package com.hxd.mall.injector.modules

import com.hxd.mall.injector.scope.ActivityScope
import com.hxd.mall.module.MainActivity
import com.hxd.mall.module.account.login.LoginActivity
import com.hxd.mall.module.account.bindphone.BindPhoneActivity
import com.hxd.mall.module.account.register.RegisterActivity
import com.hxd.mall.module.account.verifycode.VerifyCodeActivity
import com.hxd.mall.module.common.WebViewJsBridgeCommonActivity
import com.hxd.mall.module.product.ProductDetailActivity
import com.hxd.mall.module.product.home.active.ActiveActivity
import com.hxd.mall.module.product.home.HomeFragment
import com.hxd.mall.module.product.home.HomeTypeFragment
import com.hxd.mall.module.product.search.SearchActivity
import com.hxd.mall.module.product.search.history.SearchHistoryFragment
import com.hxd.mall.module.product.search.result.SearchResultFragment
import com.hxd.mall.module.school.article.ArticleActivity
import com.hxd.mall.module.school.audio.AudioActivity
import com.hxd.mall.module.school.enter.SchoolFragment
import com.hxd.mall.module.school.video.VideoActivity
import com.hxd.mall.module.startup.WelcomeActivity
import com.hxd.mall.module.usercenter.bind.AliPayBindActivity
import com.hxd.mall.module.usercenter.bindorder.BindOrderActivity
import com.hxd.mall.module.usercenter.fragment.FunsPageFragment
import com.hxd.mall.module.usercenter.fragment.PageFragment
import com.hxd.mall.module.usercenter.funs.FunsManagerActivity
import com.hxd.mall.module.usercenter.home.MineFragment
import com.hxd.mall.module.usercenter.invitataion.InvivationActivity
import com.hxd.mall.module.usercenter.message.MessageActivity
import com.hxd.mall.module.usercenter.nick.NickActivity
import com.hxd.mall.module.usercenter.order.OrderQueryActivity
import com.hxd.mall.module.usercenter.settings.SettingsActivity
import dagger.Module
import dagger.android.ContributesAndroidInjector

/**
 * We want Dagger.Android to create a Subcomponent which has a parent Component of whichever module ActivityBindingModule is on,
 * in our case that will be AppComponent. The beautiful part about this setup is that you never need to tell AppComponent that it is going to have all these subcomponents
 * nor do you need to tell these subcomponents that AppComponent exists.
 * We are also telling Dagger.Android that this generated SubComponent needs to include the specified modules and be aware of a scope annotation @ActivityScoped
 * When Dagger.Android annotation processor runs it will create 4 subcomponents for us.
 */
@Module
abstract class ActivityBindingModule {

    @ActivityScope
    @ContributesAndroidInjector(modules = [MainModule::class])
    internal abstract fun mainActivity(): MainActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [HomeFragmentModule::class])
    internal abstract fun homeFragment(): HomeFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [HomeTypeFragmentModule::class])
    internal abstract fun homeTypeFragment(): HomeTypeFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [ActiveActivityModule::class])
    internal abstract fun activeActivity(): ActiveActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [SchoolFragmentModule::class])
    internal abstract fun schoolFragment(): SchoolFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [MineFragmentModule::class])
    internal abstract fun mineFragmentModule(): MineFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [LoginModule::class])
    internal abstract fun login(): LoginActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [RegisterModule::class])
    internal abstract fun register(): RegisterActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [VerifyCodeModule::class])
    internal abstract fun verifyCode(): VerifyCodeActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [ProductDetailModule::class])
    internal abstract fun productDetail(): ProductDetailActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [ArticleModule::class])
    internal abstract fun article(): ArticleActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [AudioModule::class])
    internal abstract fun audio(): AudioActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [VideoModule::class])
    internal abstract fun video(): VideoActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [SettingsModule::class])
    internal abstract fun settings(): SettingsActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [NickModule::class])
    internal abstract fun nick(): NickActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [AlipayBindModule::class])
    internal abstract fun alipayBind(): AliPayBindActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [FunsManagerModule::class])
    internal abstract fun funsManager(): FunsManagerActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [OrderQueryModule::class])
    internal abstract fun orderQuery(): OrderQueryActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [MessageModule::class])
    internal abstract fun message(): MessageActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [SearchModule::class])
    internal abstract fun search(): SearchActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [SearchHistoryModule::class])
    internal abstract fun searchHistory(): SearchHistoryFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [SearchResultModule::class])
    internal abstract fun searchResult(): SearchResultFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [WebViewModule::class])
    internal abstract fun webViewActivity(): WebViewJsBridgeCommonActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [WelcomeModule::class])
    internal abstract fun welcomeActivity(): WelcomeActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [PageFragmentFragmentModule::class])
    internal abstract fun pageFragment(): PageFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [FunsPageFragmentModule::class])
    internal abstract fun funsPageFragment(): FunsPageFragment

    @ActivityScope
    @ContributesAndroidInjector(modules = [InvivationModule::class])
    internal abstract fun invivationActivity(): InvivationActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [BindOrderModule::class])
    internal abstract fun BindActivity(): BindOrderActivity

    @ActivityScope
    @ContributesAndroidInjector(modules = [BindPhoneModule::class])
    internal abstract fun BindPhoneActivity(): BindPhoneActivity
}
